<html>
<head>
	<title>城市排序</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link type="text/css" rel="stylesheet" href="../css/csslxh/lxh.css">
</head>
<script language="javascript">
 function moveup(sele)
 {
  var sel=-1;
  var txt="";
  var val="";
  //var formm=form1.allselect;
  var formm = sele;
  for (i=0;i<formm.options.length;i++){
    var current =formm.options[i];
    if (current.selected){
      sel = i;
      txt = current.text;
      val = current.value;
      break ;
    }
  }
  if(sel==-1){
    alert("请选择要移动的项！");
    return;
  }
  if(sel!=0){
    formm.options[sel].text=formm.options[sel-1].text;
    formm.options[sel].value=formm.options[sel-1].value;
    formm.options[sel-1].text=txt;
    formm.options[sel-1].value=val;
    formm.options[sel].selected=false;
    formm.options[sel-1].selected=true;
  }
}

function movedown(sele)
{
  var sel=-1;
  var txt="";
  var val="";
  //var formm=window.form1.allselect;
  var formm = sele;
  for (i=0;i<formm.options.length;i++){
    var current =formm.options[i];
    if (current.selected){
      sel = i;
      txt = current.text;
      val = current.value;
      break;
    }
  }
  if(sel==-1){
    alert("请选择要移动的项！");
    return;
  }
  if(sel!=formm.options.length-1){
    formm.options[sel].text=formm.options[sel+1].text;
    formm.options[sel].value=formm.options[sel+1].value;
    formm.options[sel+1].text=txt;
    formm.options[sel+1].value=val;
    formm.options[sel].selected=false;
    formm.options[sel+1].selected=true;
  }
}
function save(){
  form1.unitList.value="";
  form1.unitXhList.value="";
  var j=0;
  for (i=0;i<form1.allselect.length;i++){
     form1.unitList.value=form1.unitList.value+form1.allselect.options[i].value+",";
     j=i+1;
     form1.unitXhList.value=form1.unitXhList.value+j+",";
  }
  alert(form1.unitList.value);
  alert(form1.unitXhList.value);
  form1.action="";
  form1.submit();
}
</script>

<br><br>
<body scroll=no>
<form name="form1" method="POST" action="">
<input type=hidden name="unitList" value="">
<input type=hidden name="unitXhList" value="">
<table width="80%" border="0" cellpadding="0" cellspacing="0" align=center>
  <tr>
     <td><b><font color="#570017" size="4" face="楷体_GB2312">城市排序</font></b></td><td align=right><a href="#" onclick="save()"><b>保存排序</b></a>&nbsp;&nbsp;&nbsp;</td>
  </tr>
  <tr>
     <td colspan=2><hr align="center" width="100%" size="1" color=black></td>
  </tr>
</table>
<br>


<table width="45%" border="0" cellpadding="0" cellspacing="0" align=center>
  <tr>
     <td width=80% align=center>
        <select name="allselect" size="10" multiple style="width:200px">
        
           <option value="bj">北京</option>
        
           <option value="sh">上海</option>
        
           <option value="sz">深圳</option>
           
           <option value="wz">温州</option>
           
           <option value="qd">青岛</option>
           
        </select>
        
     </td>
     <td width=20% align=center>
          <p><input type="button" value="向上移动" name="B1" onclick="moveup(form1.allselect)"></p>
          <p><input type="button" value="向下移动" name="B2" onClick="movedown(form1.allselect)"></p>
     </td>
  </tr>
</table>


<br>
<table width="80%" border="0" cellpadding="0" cellspacing="0" align=center>
 <tr>
  <td><hr align="center" width="100%" size="1" color=black></td>
 </tr>
</table>

</form>


</body>
</html>
